package com.mgface.zookeeper.zkclient;

import org.I0Itec.zkclient.ZkClient;
import org.apache.zookeeper.data.Stat;

public class UpdateNode {
	public static void main(String[] args) {
		ZkClient client = new ZkClient("127.0.0.1:2181", 10_000, 10_000);
		boolean b = client.exists("/mgface");
		if(b){
			client.deleteRecursive("/mgface");
		}
		System.out.println(client.getChildren("/"));
		client.createPersistent("/mgface");
		client.createEphemeral("/mgface/1000", 1000);
		Stat stat = new Stat();
		client.readData("/mgface/1000", stat);
		client.writeData("/mgface/1000",1001, stat.getVersion());
		System.out.println(client.<Integer>readData("/mgface/1000"));
		
	}
}
